#ifndef _CEXPERT_SHMEM_H_
#define _CEXPERT_SHMEM_H_

#include <stdexcept>
#include <string>

namespace CExpert{
	class ShMemException : public std::runtime_error{
	public:
		ShMemException(const std::string& s);

		int err_no;
	};

  class ShMem{
  public:
    enum OpenMode{OMREAD, OMWRITE};
	static const size_t length = 100;
	typedef unsigned char* byte_ptr;

    ShMem(const char* name, OpenMode mode);
    ~ShMem();

	byte_ptr get_memory();
	const byte_ptr get_read_memory() const;
  private:
	int shm_handle_;
	void* buffer_;
	std::string name_;
  };
}

#endif
